<h3 id="activity-header"><i><%= translation('dashboard._activity.activity') %></i></h3>

<div class="activity-menu">
  <% if current_user && (current_user.moderator? || current_user.admin?) %>
    <a href="/spam" class="btn btn-sm btn-outline-secondary float-right" type="button">
      <i class="fa fa-flag"></i> 
      <%= Node.where(status: 4).size %>
    </a>
  <% end %>
</div>

<div class="meta activity-dropdown">
  <div class="btn-group">

    <button
      class="btn btn-outline-secondary btn-sm dropdown-toggle"
      type="button"
      data-toggle="dropdown"
      aria-haspopup="true"
      aria-expanded="false"
    >
      <span class="node-type-filter"><%= translation('dashboard._activity.all_updates') %></span>
      <span class="caret"></span>
    </button>

    <div class="dropdown-menu" id="checkboxes">
   <a class="form-check dropdown-item" href="#" onclick="listselect()">
        <label class="form-check-label">
          <input data-type="all" class="node-type-all" type="checkbox" checked="checked" id="selectall" />
          <%= translation('dashboard._activity.dropdown.all') %>
        </label>
      </a>

      <div class="dropdown-divider"></div>

      <a class="form-check dropdown-item" href="#" onclick="listselect()">
        <label class="form-check-label">
          <input data-type="note" class="node-type node-type-note" type="checkbox" checked="checked" />
          <%= translation('dashboard._activity.dropdown.research_notes') %>
        </label>
      </a>
      <a class="form-check dropdown-item" href="#" onclick="listselect()">
        <label class="form-check-label">
          <input data-type="question" class="node-type node-type-question" type="checkbox" checked="checked" />
          <%= translation('dashboard._activity.dropdown.question') %>
        </label>
      </a>
      <a class="form-check dropdown-item" href="#" onclick="listselect()">
        <label class="form-check-label">
          <input data-type="event" class="node-type node-type-event" type="checkbox" checked="checked" />
          <%= translation('dashboard._activity.dropdown.events') %>
        </label>
      </a>
      <a class="form-check dropdown-item" href="#" onclick="listselect()">
        <label class="form-check-label">
          <input data-type="comment" class="node-type node-type-comment" type="checkbox" checked="checked" />
          <%= translation('dashboard._activity.dropdown.comments') %>
        </label>
      </a>

      <a class="d-lg-none dropdown-item" href="#" onclick="listselect()">
        <label>
          <input data-type="wiki" class="node-type node-type-wiki" type="checkbox" checked="checked" />
          <%= translation('dashboard._activity.dropdown.wiki') %>
        </label>
      </a>
      <!--
      <li class="divider"></li>
      <li class="dropdown-header"><%=translation('tag.index.sort_by')%></li>
      <li><a href="#"><a href="#"><%= translation('dashboard._activity.post_date') %></a></li>
      <li><a href="#"><a href="#"><%= translation('dashboard._activity.recent_activity') %></a></li>
      -->
       </div>
  </div> &nbsp;
  <span class="d-none d-md-inline"><%= translation('dashboard._activity.from_other') %> <a href=""><%= translation('dashboard._activity.community_scientists') %></a></span> <%= translation('dashboard._activity.past_week') %>
  <% if current_user %>
    <span class="d-none">| <a href="/profile/<%= current_user.username %>"><%= translation('dashboard._activity.your_work') %></a></span>
  <% end %>
  <!-- (2 responses) -->
</div>

<br />
<%= feature('dashboard-activity-feature') %>

<div>
  <small><a href="/tags" class="form-grey"><%= translation('dashboard_v2.sidebar.trending_topics') %>:</a></small>
  <span class="topics-span">
   <% cache('trending-tags', expires_in: 24.hours, skip_digest: true) do %>
      <% Tag.trending.each do |i| %>
          <a href="/tag/<%= i.name %>" class="badge badge-primary"><%= i.name %></a>
      <% end %>
    <% end %>
  </span>
</div>
<%= render partial: 'tag/subscribe_button', locals:{tags: Tag.trending} %>
<div class="activity">

  <div class="row">
    <% activity.each_with_index do |node, i| %>
      <% if node.is_a?(Revision) || node.type == 'page' %>
        <%= render partial: "dashboard/node_wiki",     locals: { node: node, index: i } %>
      <% elsif node.is_a?(Comment) %>
        <%= render partial: "dashboard/node_comment",  locals: { node: node, index: i } %>
      <% elsif node.has_power_tag('question') %>
        <%= render partial: "dashboard/node_question", locals: { node: node, index: i } %>
      <% elsif node.has_tag('event') %>
        <%= render partial: "dashboard/node_event",    locals: { node: node, index: i } %>
      <% else %>
        <%= render partial: "dashboard/node_default",  locals: { node: node, index: i } %>
      <% end %>
    <% end %>
  </div>

  <br />

  <div class="text-center">
    <%= will_paginate notes, renderer: WillPaginate::ActionView::BootstrapLinkRenderer if notes %>
  </div>

</div>

<br />
